package com.csust.zerocode.ai;

import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.chat.StreamingChatModel;
import dev.langchain4j.service.AiServices;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * AI代码生成类型路由服务工厂
 *
 * @author 钰玟
 */
@Slf4j
@Configuration
public class TestThinkingServiceFactory {

    @Resource
    private StreamingChatModel reasoningStreamingChatModelPrototype;
    @Resource(name = "openAiChatModel")
    private ChatModel chatModel;

    /**
     * 创建AI代码生成类型路由服务实例
     */
    @Bean
    public TestThinkingService testThinkingService() {
        return AiServices.builder(TestThinkingService.class)
                .chatModel(chatModel)
                .streamingChatModel(reasoningStreamingChatModelPrototype)
                .build();
    }
}
